{% extends "base.html" %}

{% block app_content %}
    <table>
        <tr valign="top">
            <td><img src="{{ user.avatar(128) }}"></td>
            <td>
                <h1>用户: {{ user.username }}</h1>
                {% if user.about_me %}<p>自我介绍:{{ user.about_me }}</p>{% endif %}
                {% if user.last_seen %}<p>最后登录时间: {{ moment(user.last_seen).format('LLL') }}</p>{% endif %}
                <p>关注数:{{ user.followers.count() }},  被关注数:{{ user.followed.count() }} </p>
                {% if user == current_user %}
                    <p><a href="{{ url_for('main.edit_profile') }}">编辑个人信息</a></p>
                {% elif not current_user.is_following(user) %}
                    <p><a href="{{ url_for('main.follow', username=user.username) }}">关注</a></p>
                {% else %}
                    <p><a href="{{ url_for('main.unfollow', username=user.username) }}">取消关注</a></p>
                {% endif %}
                {% if user != current_user %}
                    <p>
                        <a href="{{ url_for('main.send_message',recipient=user.username) }}">
                            {{'发送消息'}}
                        </a>
                    </p>
                {% endif %}
            </td>
        </tr>        
    </table>
    <hr>
    {% for post in posts %}
        {% include '_post.html' %}
    {% endfor %}
    <nav aria-label="...">
        <ul class="pager">
            <li class="previous{% if not prev_url %} disabled{% endif %}">
                <a href="{{ prev_url or '#' }}">
                    <span aria-hidden="true">&larr;</span> 下一页
                </a>
            </li>
            <li class="next{% if not next_url %} disabled{% endif %}">
                <a href="{{ next_url or '#' }}">
                    上一页<span aria-hidden="true">&rarr;</span>
                </a>
            </li>
        </ul>
    </nav>
{% endblock %}